﻿/*
 * DotNetCrypt - an open source library of cryptographic algorithms for .NET
 * Copyright (C) 2009 David Musgrove
 * 
 * This file is part of DotNetCrypt.
 *
 * DotNetCrypt is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * DotNetCrypt is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

using System.Security.Cryptography;

namespace DotNetCrypt
{
    /// <summary>
    /// Computes the <see cref="Tiger" /> hash for the input data.
    /// </summary>
    public abstract class Tiger : ManagedHashAlgorithmBase
    {
        /// <summary>
        /// Initializes a new <see cref="Tiger" /> instance.
        /// </summary>
        protected Tiger()
        {
            HashSizeValue = 0xc0;
        }

        /// <summary>
        /// Gets the input block size.
        /// </summary>
        /// <returns>
        /// The input block size.
        /// </returns>
        public override int InputBlockSize
        {
            get { return 0x40; }
        }

        /// <summary>
        /// Gets the output block size.
        /// </summary>
        /// <returns>
        /// The output block size.
        /// </returns>
        public override int OutputBlockSize
        {
            get { return 0x40; }
        }

        /// <overloads>
        /// Allows specific implementations of this abstract class to be
        /// instantiated.
        /// </overloads>
        /// <summary>
        /// Creates an instance of the default implementation of
        /// <see cref="Tiger" />.
        /// </summary>
        /// <returns>
        /// A new instance of <see cref="Tiger" />.
        /// </returns>
        static public new Tiger Create()
        {
            return Create("DotNetCrypt.Tiger");
        }

        /// <summary>
        /// Creates an instance of a specified implementation of
        /// <see cref="Tiger" />.
        /// </summary>
        /// <param name="hashName">
        /// The name of the specific implementation of <see cref="Tiger" />
        /// to be used.
        /// </param>
        /// <returns>
        /// A new instance of <see cref="Tiger" /> using the specified
        /// implementation.
        /// </returns>
        static public new Tiger Create(string hashName)
        {
            return (Tiger)CryptoConfig.CreateFromName(hashName);
        }
    }
}
